package cn.kgc.mes.workstation.service.impl;

import java.util.List;
import cn.kgc.mes.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.kgc.mes.workstation.mapper.WorkstationMapper;
import cn.kgc.mes.workstation.domain.Workstation;
import cn.kgc.mes.workstation.service.IWorkstationService;

/**
 * 工作站Service业务层处理
 * 
 * @author jiyupo
 * @date 2025-09-10
 */
@Service
public class WorkstationServiceImpl implements IWorkstationService 
{
    @Autowired
    private WorkstationMapper workstationMapper;

    /**
     * 查询工作站
     * 
     * @param workstationId 工作站主键
     * @return 工作站
     */
    @Override
    public Workstation selectWorkstationByWorkstationId(Long workstationId)
    {
        return workstationMapper.selectWorkstationByWorkstationId(workstationId);
    }

    /**
     * 查询工作站列表
     * 
     * @param workstation 工作站
     * @return 工作站
     */
    @Override
    public List<Workstation> selectWorkstationList(Workstation workstation)
    {
        return workstationMapper.selectWorkstationList(workstation);
    }

    /**
     * 新增工作站
     * 
     * @param workstation 工作站
     * @return 结果
     */
    @Override
    public int insertWorkstation(Workstation workstation)
    {
        workstation.setCreateTime(DateUtils.getNowDate());
        return workstationMapper.insertWorkstation(workstation);
    }

    /**
     * 修改工作站
     * 
     * @param workstation 工作站
     * @return 结果
     */
    @Override
    public int updateWorkstation(Workstation workstation)
    {
        workstation.setUpdateTime(DateUtils.getNowDate());
        return workstationMapper.updateWorkstation(workstation);
    }

    /**
     * 批量删除工作站
     * 
     * @param workstationIds 需要删除的工作站主键
     * @return 结果
     */
    @Override
    public int deleteWorkstationByWorkstationIds(Long[] workstationIds)
    {
        return workstationMapper.deleteWorkstationByWorkstationIds(workstationIds);
    }

    /**
     * 删除工作站信息
     * 
     * @param workstationId 工作站主键
     * @return 结果
     */
    @Override
    public int deleteWorkstationByWorkstationId(Long workstationId)
    {
        return workstationMapper.deleteWorkstationByWorkstationId(workstationId);
    }
}
